//
//  BaseViewController.m
//  待定
//
//  Created by BoyaLee on 15/11/4.
//  Copyright © 2015年 BoyaLee. All rights reserved.
//

#import "BaseViewController.h"

@interface BaseViewController ()

@end

@implementation BaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
#warning 注册通知
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeColor:) name:@"changeColor" object:nil];
    if ([[NSUserDefaults standardUserDefaults] boolForKey:@"night"]) {
        self.navigationController.navigationBar.barTintColor = BGNIGHTMODEL;
        self.view.backgroundColor = BGNIGHTMODEL;
    }
    else
    {
        self.navigationController.navigationBar.barTintColor = BGDAYMODEL;
        self.view.backgroundColor = BGDAYMODEL;
        
    }

}


-(void)changeColor:(NSNotification *)notification
{
    NSString *str = [notification object];
    if ([str isEqualToString:@"no"]) {
        self.view.backgroundColor = BGDAYMODEL;
        self.navigationController.navigationBar.barTintColor = BGDAYMODEL;
    }
    else
    {
        self.navigationController.navigationBar.barTintColor = BGNIGHTMODEL;
        self.view.backgroundColor = BGNIGHTMODEL;
    }
}

- (void)initBaseVCViews {
    
    self.view.backgroundColor = [UIColor whiteColor];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
